package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ActivityItem;
import com.api.shopapi.entity.AskAnswerGroup;
import com.api.shopapi.mapper.AskAnswerGroupMapper;
import com.api.shopapi.service.AskAnswerGroupService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("AskAnswerGroupServiceImplOne")
public class AskAnswerGroupServiceImpl implements AskAnswerGroupService {

    @Autowired
    private AskAnswerGroupMapper askAnswerGroupMapper;

    @Override
    public
    int insert(AskAnswerGroup askAnswerGroup){
        return askAnswerGroupMapper.insert(askAnswerGroup);
    }


    @Override
    public
    int delete(String askAnswerGroupCode){
        return askAnswerGroupMapper.delete(askAnswerGroupCode);
    }


    @Override
    public
    int update(AskAnswerGroup askAnswerGroup){
        return askAnswerGroupMapper.update(askAnswerGroup);
    }


    @Override
    public
    AskAnswerGroup getByAskAnswerGroupCode(String askAnswerGroupCode){
        return askAnswerGroupMapper.getByAskAnswerGroupCode(askAnswerGroupCode);
    }

    @Override
    public
    List<AskAnswerGroup> listByAskAnswerNameCode(String askAnswerNameCode){
        return askAnswerGroupMapper.listByAskAnswerNameCode(askAnswerNameCode);
    }

    @Override
    public
    PageInfo<AskAnswerGroup> pageByCommandCenterCodeAskAnswerNameCode(int pageIndex, int pageSize,
                                                                   String commandCenterCode, String askAnswerNameCode){

        PageHelper.startPage(pageIndex,pageSize);
        List<AskAnswerGroup> complaintList =askAnswerGroupMapper.listByCommandCenterCodeAskAnswerNameCode(commandCenterCode,askAnswerNameCode);
        return new PageInfo<>(complaintList);

    }

    @Override
    public
    PageInfo<AskAnswerGroup> pageByGovCodeTypeAskAnswerNameCode(int pageIndex, int pageSize,
                                                            String govCode,   String type,
                                                            String askAnswerNameCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<AskAnswerGroup> complaintList =askAnswerGroupMapper.listByGovCodeTypeAskAnswerNameCode(govCode,type,askAnswerNameCode);
        return new PageInfo<>(complaintList);
    }



}
